#include<iostream>
using namespace std;
int n;
int main()
{
	while (cin >> n, n) {
		int max = -10000;
		for (int i = 0; i < n; i++) {
			int a;
			cin >> a;
			if (max < a) {
				max = a;
			}
		}
		cout << max << endl;
	}
	return 0;
}